using System;
using System.Collections.Generic;
using PokerStar.Core.Rules;

namespace PokerStar.Core
{
    public abstract class GameResult : IComparable<GameResult>
    {
        public int CompareTo(GameResult other)
        {
            int rs = (int)Level - (int)other.Level;

            if (rs == 0)
                return RuleCompareTo(other);

            return rs;
        }

        protected virtual int RuleCompareTo(GameResult other)
        {
            // default implementation, suitable for nothing, staight, flush
            for (int i = 0; i < 5; i++)
            {
                var r = Evidence[i] - other.Evidence[i];
                if (r != 0)
                    return r;
            }
            return 0;
        }

        //public override string ToString()
        //{
        //    return "Result calcuation has not been implemented...";
        //}

        public abstract ResultLevel Level { get; }
        public IList<int> Evidence { get; set; }
        public IList<Card> Cards { get; set; }
    }
}